#ifndef TOTEM_LRC_PAD_H
#define TOTEM_LRC_PAD_H

typedef struct _TotemLrcPad TotemLrcPad ;
typedef struct _TotemLrcPadClass TotemLrcPadClass;

typedef enum{
	LRC_RUN,
	LRC_STOP,
	LRC_RELOAD,
	LRC_TIMEOUT_LIST
}LrcTimeState;

enum{
	COL_NUM,
	COL_ARTIST,
	COL_TITLE,
	COL_URL,
	COL_LAST
};

typedef enum{
	DIALOG_NOTHINGS = 10,
	DIALOG_DOWNLOAD,
	DIALOG_SEARCH,
	DIALOG_LAST
}DialogId;

typedef struct{
	GtkEntry *artist;
	GtkEntry *title;
	TotemLrcPad *pad;
	GtkTreeView *treeview;
	GtkTreeSelection *select;
}CallData;

struct _TotemLrcPad
{
	GtkScrolledWindow parent;
	GtkTextView *view;
	GtkTextBuffer *buf;
	GtkTextTag *tag;
	GtkDialog *download_dialog;
	TotemLrcPlugin *pi;
	gulong timeout_id;
	LrcTimeState lts;
};

struct _TotemLrcPadClass
{
	GtkScrolledWindowClass parent_class;
	gboolean (*timeout)(TotemLrcPad *pad);
};

typedef struct __LRC__{
gint64 tm;
gint pt;
gint n;
} lrc_st;

#define max_lrc_line 1024

GType totem_lrc_pad_get_type		(void);

#define TOTEM_LRC_PAD_TYPE              (totem_lrc_pad_get_type ())
#define TOTEM_LRC_PAD(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOTEM_LRC_PAD_TYPE, TotemLrcPad))
#define TOTEM_LRC_PAD_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TOTEM_LRC_PAD_TYPE, TotemLrcPadClass))
#define TOTEM_LRC_IS_PAD(obj)           (G_TYPE_CHECK_INSTANCE_TYPE (obj, TOTEM_LRC_PAD_TYPE))
#define TOTEM_LRC_IS_PAD_CLASS(klass)   (G_CHECK_INSTANCE_GET_CLASS ((klass), TOTEM_LRC_PAD_TYPE))
#define TOTEM_LRC_PAD_GET_CLASS(o)      (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_LRC_PAD_TYPE, TotemLrcPadClass))

GtkWidget *totem_lrc_pad_new(TotemLrcPlugin *pi);
gboolean totem_lrc_pad_load_lrc(TotemLrcPad *pad);
void totem_lrc_pad_set_text(TotemLrcPad *pad,gchar *text);
void totem_lrc_pad_clear(TotemLrcPad *pad);
void totem_lrc_pad_run(TotemLrcPad *pad);
void totem_lrc_pad_response(TotemLrcPad *pad,DialogId id);

#endif //TOTEM_LRC_PAD_H
